<%--
  Created by IntelliJ IDEA.
  User: mac
  Date: 13-12-24
  Time: 10:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="jsptag.jsp"%>
<style type="text/css">
    #control { float: right; padding-top: 5px; }
    #control div { display:inline;padding-left:20px; }
    #control label { margin-left: 10px; margin-right: 10px; }
    #control a { background: none repeat scroll 0 0 #6495ed; padding: 5px; border-radius: 15px;}
    #control a:hover { background: none repeat scroll 0 0 #0184C8; color: #FFFFFF; text-decoration: none;}
</style>
<script type="text/javascript">
    function forward() {
        var form = document.createElement("form");
        form.action = '/page/filmListByCondition.html';
        form.method = 'POST';

        var pageInput = document.createElement("input") ;
        pageInput.name = 'page';
        pageInput.value = arguments[0];
        form.appendChild(pageInput);

        <c:forEach var="item" items="${parameter}" begin="0" varStatus="itemIndex">
        <c:if test="${item.value != null}">
        var input${itemIndex.index} = document.createElement("input");
        input${itemIndex.index}.name = '${item.key}';
        input${itemIndex.index}.value = '${item.value}';
        form.appendChild(input${itemIndex.index});
        </c:if>
        </c:forEach>

        document.body.appendChild(form) ;
        form.submit() ;
        document.body.removeChild(form) ;
    }
</script>

<div id="control">
    <a href="javascript:void(0);" onclick="javascript:forward('1');" class="someClass" title="跳转到首页"><<</a>
    <c:choose>
        <c:when test="${pageCount.currentPage == 1}">
            <a href="javascript:void(0);" style="background-color: #808080;"><</a>
        </c:when>
        <c:otherwise>
            <a href="javascript:void(0);" onclick="javascript:forward('${pageCount.currentPage - 1}');" class="someClass" title="跳转到上一页"><</a>
        </c:otherwise>
    </c:choose>
    <label>${pageCount.currentPage},${pageCount.totalPage} 页</label>
    <c:choose>
        <c:when test="${pageCount.currentPage == pageCount.totalPage}">
            <a href="javascript:void(0);" style="background-color: #808080;">></a>
        </c:when>
        <c:otherwise>
            <a href="javascript:void(0);" onclick="javascript:forward('${pageCount.currentPage + 1}');" class="someClass" title="跳转到下一页">></a>
        </c:otherwise>
    </c:choose>
    <a href="javascript:void(0);" onclick="javascript:forward('${pageCount.totalPage}');" class="someClass" title="跳转到尾页">>></a>

    <div>
        跳转到
        <select onchange="forward(this.value);">
            <c:forEach begin="1" end="${pageCount.totalPage}" varStatus="page">
                <option value="${page.index}" <c:if test="${pageCount.currentPage == page.index}">selected</c:if>>${page.index}页</option>
            </c:forEach>
        </select>
    </div>
</div>

